﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mads.CoreDomain
{
  /// <summary>
  /// Represents a person who is mentioned in a ticket.
  /// </summary>
  public class TicketOwner : KeyAbstraction, IEquatable<TicketOwner>
  {
    /// <summary>
    /// Name of the person (incl. initials).
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Document data.
    /// </summary>
    public string DocNumber { get; set; }

    public TicketOwner(string name, string docNumber)
    {
      if (String.IsNullOrEmpty(name))
      {
        throw new ArgumentException("name");
      }
      if (String.IsNullOrEmpty(docNumber))
      {
        throw new ArgumentException("docNumber");
      }

      Name = name;
      DocNumber = docNumber;
    }

    public TicketOwner(uint id)
      : base(id)
    { }

    public bool Equals(TicketOwner other)
    {
      return other != null && ID.Equals(other.ID) && DocNumber.Equals(other.DocNumber);
    }
  }
}